<%
    for (var i = 0; i < dataTypeList.length; i++) {
        dataTypeList[i] = dataTypeList[i].replace('int','number')
    }
    keyType = keyType.replace('int','number')
    function getTypeWithIndex(index){
        var ret = ""
        for (var i = index; i < dataTypeList.length; i++) {
            ret += "Map<" + dataTypeList[i] +","
        }
        ret += "Array<" + keyType
        for (var i = index; i < dataTypeList.length - 1; i++) {
            ret += ">"
        }
        ret += ">>"
        return ret
    }
    function getFuncParam(){
        var ret = []
        for (var i = 0; i < dataNameList.length; i++) {
            ret.push( dataNameList[i] + " : " + dataTypeList[i])
        }
        return ret.join(",")
    }

%>
//#region  <%= methodName %>ComplexMultipleIndex
    public _<%= initMethodName %>ComplexIndexDict : <%- getTypeWithIndex(0) %>  = new <%- getTypeWithIndex(0) %>();

    private <%= initMethodName %>()
    {
        this._<%= initMethodName %>ComplexIndexDict = this._headJsonData.<%= keyName %>ComplexIndex;
//        var dict = this._headJsonData.<%= keyName %>ComplexIndex;
//        for (var v in dict)
//        {
//            var p = dict[v]
<%if(keyType === "number"){%>
//            this.Add<%= initMethodName %>SingleData(Number(v), p);
<%}else if (keyType === "string"){%>
//            this.Add<%= initMethodName %>SingleData(v, p);
<%}%>
//        }
        //初始化完之后销毁, 减小内存占用
        this._headJsonData.<%= keyName %>ComplexIndex = null
//    }

//    private Add<%= initMethodName %>SingleData(id : <%= keyType %> ,  KeyNameList : Map<any,any>)
//    {
//        var ret = this._<%= initMethodName %>ComplexIndexDict;
<%for (var i = 0; i < dataTypeList.length - 1; i++) { %>
//        var key<%= i %> = KeyNameList.get("<%- dataNameList[i] %>");
//        var ret<%= i %> :  <%= getTypeWithIndex(i+1) %> = null;
<% var tempKey; if (i === 0) tempKey = ""; else tempKey = i-1%>
//        if (!ret<%= tempKey%>.has(key<%= i %>))
//        {
//            ret<%= i %> = new <%= getTypeWithIndex(i+1) %>();
//            ret<%= tempKey%>.set(key<%=i%>,ret<%=i %>);
//        }else{
//            ret<%= i %> = ret<%= tempKey%>.get(key<%=i %>)
//        }
<%}%>
//        if (!ret<%=dataTypeList.length - 1%>.has(key<%=dataTypeList.length - 1%>))
//        {
//            ret<%=dataTypeList.length - 1%> = new Map<number,Array<string>>();
//            ret<%=dataTypeList.length - 2%>.set(key<%=dataTypeList.length - 1%>,ret<%=dataTypeList.length - 1%>);
//        }else{
//            ret<%=dataTypeList.length - 1%> = ret<%=dataTypeList.length - 2%>.get(key<%=dataTypeList.length - 1%>)
//        }
//        ret<%=dataTypeList.length - 1%>.set(key<%=dataTypeList.length - 1%>,key<%=dataTypeList.length - 1%>.get["<%- dataNameList[dataTypeList.length - 1] %>"]);
    }

    public <%= methodName %>(<%=getFuncParam() %>) :  Array<<%= className %>>
    {
        var retList = new Array<<%= className %>>();
        var ret = this._<%= initMethodName %>ComplexIndexDict;
<%for (var i = 0; i < dataTypeList.length - 1; i++) { %>
        var key<%= i %> = <%= dataNameList[i] %>
        var ret<%= i %> :  <%= getTypeWithIndex(i+1) %> = null;
<% var tempKey; if (i === 0) tempKey = ""; else tempKey = i-1%>
        if (!ret<%= tempKey%>.has(key<%= i %>))
        {
            return retList;
        }else{
            ret<%= i %> = ret<%= tempKey%>.get(key<%=i %>)
        }
<%}%>
<%i = dataTypeList.length - 1%>
        var key<%= i %> = <%= dataNameList[i] %>
        var configKeyList = null;
        if (!ret<%= i - 1 %>.has(key<%= i %>))
        {
            return retList
        }else{
            configKeyList = ret<%= i -1 %>.get(key<%= i %>)
        }
        for (let i = 0; i < configKeyList.length; i++) {
            const key = configKeyList[i]
            retList.push(this.GetConfigByKey(key))
        }
        return retList
    }
//#endregion